﻿using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SharpCommon.Data;
using SharpCommon.Extension;

namespace Test
{
    [TestClass]
    public class DataReaderExtensionTest
    {
        [TestMethod]
        public void GenerateInfos()
        {
            string strSQL = "select * from Person";
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            using (IDataReader dataReader = DataBaseContext.DBInstance.ExecuteReader(strSQL))
            {
                IList<Person> actual = dataReader.GenerateInfos<Person>();
                stopwatch.Stop();
                Assert.Inconclusive(stopwatch.ElapsedMilliseconds.ToString());
                //Assert.IsNotNull(actual);
                //Assert.IsTrue(actual.Count > 0);
            }
        }
    }

    public class Person
    {
        public string Name { get; set; }

        public int Age { get; set; }

        public Sex Sex { get; set; }

        public string Address { get; set; }

        public string PhoneNumber { get; set; }
    }

    public enum Sex
    {
        Girl = 0,
        Boy = 1
    }
}
